package com.gulimall.cart.controller;

import com.gulimall.cart.service.ICartService;
import com.gulimall.common.core.domain.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/cart")
@Slf4j
public class CartController {
    @Resource
    private ICartService cartService;

    /**
     * 把购物车信息存入redis
     */
    @PostMapping("/setCartInfo/{skuId}")
    public Result setCartInfo(@PathVariable("skuId") Long skuId){
        log.info("商品的skuId为：{}",skuId);
        cartService.setCartInfo(skuId);
        return Result.ok();
    }
}
